/**
 * Created by Administrator on 14-2-10.
 */
var mongoose = require('mongoose');
var timestamps = require('mongoose-timestamp');//(给Model自动添加createdAt和updatedAt):

var Schema = mongoose.Schema,
    ObjectId = Schema.ObjectId;

// 页信息
var schema_his_page = new Schema({
    doc_id:Number, // 用户文档的id
    page_index:Number, // 页index
    page_id:Number, // 页id
    base_page_id:Number, // 来源页id
    replaces:String,     // replaces
},{_id:false,versionKey:false});

// Schema 结构
var schema = new Schema({
    // _id:ObjectId, // default id
    orig_flg:Number,// 原始记录flg［1:未经过切换；0:经过切换］
    doc_id:Number, // 用户文档的id
    tmpl_id:Number, // 模板的id
    thumb:String,// 模版首页预览图
    pages:[schema_his_page], // 可替换模版的数组
});
schema.plugin(timestamps);

mongoose.model('MUserHistoryModel', schema, 'MUserHistory');
